package com.example.demo.huawei;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Scanner;

public class Main40 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        // a:3,b:5,c:2@a:1,b:2
        // 输出
        //        a:2,b:3,c:2

        HashMap<Character, Integer> all = new LinkedHashMap<>();
        HashMap<Character, Integer> used = new LinkedHashMap<>();
        String line = sc.nextLine();
        String[] split = line.split("@");
        if (split.length == 1) { // 没有已占用字符的情况
            System.out.println(split[0]);
            return;
        }
        // 记录已占用到used
        String[] split3 = split[1].split(",");
        for (String s : split3) {
            String[] split2 = s.split(":");
            used.put(split2[0].charAt(0), Integer.parseInt(split2[1]));
        }
        // 占用记录到map
        String[] split1 = split[0].split(",");
        for (String s : split1) {
            String[] split2 = s.split(":");
            all.put(split2[0].charAt(0), Integer.parseInt(split2[1]) - used.getOrDefault(split2[0].charAt(0), 0));
        }

        //        System.out.println(all);
        //        System.out.println(used);

        StringBuilder sb = new StringBuilder();
        for (Map.Entry<Character, Integer> entry : all.entrySet()) {
            if (entry.getValue() > 0) {
                sb.append(entry.getKey()).append(":").append(entry.getValue()).append(",");
            }
        }

        System.out.println(sb.substring(0, sb.length() - 1));
    }
}
